<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qtransform.cpp -->
  <title>QTransform Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QTransform</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#static-public-members">Static Public Members</a></li>
<li class="level1"><a href="#related-non-members">Related Non-Members</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
<li class="level2"><a href="#rendering-graphics">Rendering Graphics</a></li>
<li class="level2"><a href="#basic-matrix-operations">Basic Matrix Operations</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QTransform Class</h1>
<!-- $$$QTransform-brief -->
<p>The QTransform class specifies 2D transformations of a coordinate system. <a href="#details">More...</a></p>
<!-- @@@QTransform -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QTransform&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.3</td></tr></table></div><p>This class was introduced in Qt 4.3.</p>
<ul>
<li><a href="qtransform-members.html">List of all members, including inherited members</a></li>
<li><a href="qtransform-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#TransformationType-enum">TransformationType</a></b> { TxNone, TxTranslate, TxScale, TxRotate, TxShear, TxProject }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#QTransform-4">QTransform</a></b>(const QMatrix &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#QTransform-3">QTransform</a></b>(qreal <i>m11</i>, qreal <i>m12</i>, qreal <i>m21</i>, qreal <i>m22</i>, qreal <i>dx</i>, qreal <i>dy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#QTransform-2">QTransform</a></b>(qreal <i>m11</i>, qreal <i>m12</i>, qreal <i>m13</i>, qreal <i>m21</i>, qreal <i>m22</i>, qreal <i>m23</i>, qreal <i>m31</i>, qreal <i>m32</i>, qreal <i>m33</i> = 1.0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#QTransform-1">QTransform</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-eq-1">operator=</a></b>(const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m11">m11</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m12">m12</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m13">m13</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m21">m21</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m22">m22</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m23">m23</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m31">m31</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m32">m32</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#m33">m33</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#adjoint">adjoint</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#determinant">determinant</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#dx">dx</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qreal </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#dy">dy</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#inverted">inverted</a></b>(bool *<i>invertible</i> = nullptr) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#isAffine">isAffine</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#isIdentity">isIdentity</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#isInvertible">isInvertible</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#isRotating">isRotating</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#isScaling">isScaling</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#isTranslating">isTranslating</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map">map</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal *<i>tx</i>, qreal *<i>ty</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-1">map</a></b>(const QPoint &amp;<i>point</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPointF </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-2">map</a></b>(const QPointF &amp;<i>p</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLine </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-3">map</a></b>(const QLine &amp;<i>l</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLineF </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-4">map</a></b>(const QLineF &amp;<i>line</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygonF </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-5">map</a></b>(const QPolygonF &amp;<i>polygon</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-6">map</a></b>(const QPolygon &amp;<i>polygon</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRegion </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-7">map</a></b>(const QRegion &amp;<i>region</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-8">map</a></b>(const QPainterPath &amp;<i>path</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#map-9">map</a></b>(int <i>x</i>, int <i>y</i>, int *<i>tx</i>, int *<i>ty</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#mapRect">mapRect</a></b>(const QRectF &amp;<i>rectangle</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#mapRect-1">mapRect</a></b>(const QRect &amp;<i>rectangle</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#mapToPolygon">mapToPolygon</a></b>(const QRect &amp;<i>rectangle</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#reset">reset</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#rotate">rotate</a></b>(qreal <i>angle</i>, Qt::Axis <i>axis</i> = Qt::ZAxis)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#rotateRadians">rotateRadians</a></b>(qreal <i>angle</i>, Qt::Axis <i>axis</i> = Qt::ZAxis)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#scale">scale</a></b>(qreal <i>sx</i>, qreal <i>sy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#setMatrix">setMatrix</a></b>(qreal <i>m11</i>, qreal <i>m12</i>, qreal <i>m13</i>, qreal <i>m21</i>, qreal <i>m22</i>, qreal <i>m23</i>, qreal <i>m31</i>, qreal <i>m32</i>, qreal <i>m33</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#shear">shear</a></b>(qreal <i>sh</i>, qreal <i>sv</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QMatrix &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#toAffine">toAffine</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#translate">translate</a></b>(qreal <i>dx</i>, qreal <i>dy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#transposed">transposed</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform::TransformationType </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#type">type</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-QVariant">operator QVariant</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-not-eq">operator!=</a></b>(const QTransform &amp;<i>matrix</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a">operator*</a></b>(const QTransform &amp;<i>matrix</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-eq">operator*=</a></b>(const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-eq-1">operator*=</a></b>(qreal <i>scalar</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2b-eq">operator+=</a></b>(qreal <i>scalar</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator--eq">operator-=</a></b>(qreal <i>scalar</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2f-eq">operator/=</a></b>(qreal <i>scalar</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-eq-eq">operator==</a></b>(const QTransform &amp;<i>matrix</i>) const</td></tr>
</table></div>
<a name="static-public-members"></a>
<h2 id="static-public-members">Static Public Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#fromScale">fromScale</a></b>(qreal <i>sx</i>, qreal <i>sy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QTransform </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#fromTranslate">fromTranslate</a></b>(qreal <i>dx</i>, qreal <i>dy</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#quadToQuad">quadToQuad</a></b>(const QPolygonF &amp;<i>one</i>, const QPolygonF &amp;<i>two</i>, QTransform &amp;<i>trans</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#quadToSquare">quadToSquare</a></b>(const QPolygonF &amp;<i>quad</i>, QTransform &amp;<i>trans</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#squareToQuad">squareToQuad</a></b>(const QPolygonF &amp;<i>quad</i>, QTransform &amp;<i>trans</i>)</td></tr>
</table></div>
<a name="related-non-members"></a>
<h2 id="related-non-members">Related Non-Members</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#qFuzzyCompare">qFuzzyCompare</a></b>(const QTransform &amp;<i>t1</i>, const QTransform &amp;<i>t2</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> uint </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#qHash-3">qHash</a></b>(const QTransform &amp;<i>key</i>, uint <i>seed</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPoint </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-11">operator*</a></b>(const QPoint &amp;<i>point</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPointF </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-12">operator*</a></b>(const QPointF &amp;<i>point</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLineF </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-13">operator*</a></b>(const QLineF &amp;<i>line</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QLine </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-14">operator*</a></b>(const QLine &amp;<i>line</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygon </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-15">operator*</a></b>(const QPolygon &amp;<i>polygon</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPolygonF </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-16">operator*</a></b>(const QPolygonF &amp;<i>polygon</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRegion </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-17">operator*</a></b>(const QRegion &amp;<i>region</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-2a-18">operator*</a></b>(const QPainterPath &amp;<i>path</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-lt-lt-21">operator&lt;&lt;</a></b>(QDataStream &amp;<i>stream</i>, const QTransform &amp;<i>matrix</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qtransform.html#operator-gt-gt">operator&gt;&gt;</a></b>(QDataStream &amp;<i>stream</i>, QTransform &amp;<i>matrix</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QTransform-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>A transformation specifies how to translate, scale, shear, rotate or project the coordinate system, and is typically used when rendering graphics.</p>
<p>QTransform differs from QMatrix in that it is a true 3x3 matrix, allowing perspective transformations. QTransform's <a href="qtransform.html#toAffine">toAffine</a>() method allows casting QTransform to QMatrix. If a perspective transformation has been specified on the matrix, then the conversion will cause loss of data.</p>
<p>QTransform is the recommended transformation class in Qt.</p>
<p>A QTransform object can be built using the <a href="qtransform.html#setMatrix">setMatrix</a>(), <a href="qtransform.html#scale">scale</a>(), <a href="qtransform.html#rotate">rotate</a>(), <a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#shear">shear</a>() functions. Alternatively, it can be built by applying <a href="qtransform.html#basic-matrix-operations">basic matrix operations</a>. The matrix can also be defined when constructed, and it can be reset to the identity matrix (the default) using the <a href="qtransform.html#reset">reset</a>() function.</p>
<p>The QTransform class supports mapping of graphic primitives: A given point, line, polygon, region, or painter path can be mapped to the coordinate system defined by <i>this</i> matrix using the <a href="qtransform.html#map">map</a>() function. In case of a rectangle, its coordinates can be transformed using the <a href="qtransform.html#mapRect">mapRect</a>() function. A rectangle can also be transformed into a <i>polygon</i> (mapped to the coordinate system defined by <i>this</i> matrix), using the <a href="qtransform.html#mapToPolygon">mapToPolygon</a>() function.</p>
<p>QTransform provides the <a href="qtransform.html#isIdentity">isIdentity</a>() function which returns <code>true</code> if the matrix is the identity matrix, and the <a href="qtransform.html#isInvertible">isInvertible</a>() function which returns <code>true</code> if the matrix is non-singular (i.e&#x2e; AB = BA = I). The <a href="qtransform.html#inverted">inverted</a>() function returns an inverted copy of <i>this</i> matrix if it is invertible (otherwise it returns the identity matrix), and <a href="qtransform.html#adjoint">adjoint</a>() returns the matrix's classical adjoint. In addition, QTransform provides the <a href="qtransform.html#determinant">determinant</a>() function which returns the matrix's determinant.</p>
<p>Finally, the QTransform class supports matrix multiplication, addition and subtraction, and objects of the class can be streamed as well as compared.</p>
<a name="rendering-graphics"></a>
<h3 id="rendering-graphics">Rendering Graphics</h3>
<p>When rendering graphics, the matrix defines the transformations but the actual transformation is performed by the drawing routines in <a href="qpainter.html">QPainter</a>.</p>
<p>By default, <a href="qpainter.html">QPainter</a> operates on the associated device's own coordinate system. The standard coordinate system of a <a href="qpaintdevice.html">QPaintDevice</a> has its origin located at the top-left position. The <i>x</i> values increase to the right; <i>y</i> values increase downward. For a complete description, see the <a href="coordsys.html">coordinate system</a> documentation.</p>
<p><a href="qpainter.html">QPainter</a> has functions to translate, scale, shear and rotate the coordinate system without using a QTransform. For example:</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qtransform-simpletransformation.png" alt="" /></td><td ><pre class="cpp">

  <span class="type">void</span> SimpleTransformation<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
  {
      <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
      painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type">Qt</span><span class="operator">::</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>DashLine));
      painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);

      painter<span class="operator">.</span>rotate(<span class="number">45</span>);

      painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">&quot;Helvetica&quot;</span><span class="operator">,</span> <span class="number">24</span>));
      painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type">Qt</span><span class="operator">::</span>black<span class="operator">,</span> <span class="number">1</span>));
      painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">&quot;QTransform&quot;</span>);
  }

</pre>
</td></tr>
</table></div>
<p>Although these functions are very convenient, it can be more efficient to build a QTransform and call <a href="qpainter.html#setTransform">QPainter::setTransform</a>() if you want to perform more than a single transform operation. For example:</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qtransform-combinedtransformation.png" alt="" /></td><td ><pre class="cpp">

  <span class="type">void</span> CombinedTransformation<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
  {
      <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
      painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type">Qt</span><span class="operator">::</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>DashLine));
      painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);

      <span class="type">QTransform</span> transform;
      transform<span class="operator">.</span>translate(<span class="number">50</span><span class="operator">,</span> <span class="number">50</span>);
      transform<span class="operator">.</span>rotate(<span class="number">45</span>);
      transform<span class="operator">.</span>scale(<span class="number">0.5</span><span class="operator">,</span> <span class="number">1.0</span>);
      painter<span class="operator">.</span>setTransform(transform);

      painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">&quot;Helvetica&quot;</span><span class="operator">,</span> <span class="number">24</span>));
      painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type">Qt</span><span class="operator">::</span>black<span class="operator">,</span> <span class="number">1</span>));
      painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">&quot;QTransform&quot;</span>);
  }

</pre>
</td></tr>
</table></div>
<a name="basic-matrix-operations"></a>
<h3 id="basic-matrix-operations">Basic Matrix Operations</h3>
<p class="centerAlign"><img src="images/qtransform-representation.png" alt="" /></p><p>A QTransform object contains a 3 x 3 matrix. The <code>m31</code> (<code>dx</code>) and <code>m32</code> (<code>dy</code>) elements specify horizontal and vertical translation. The <code>m11</code> and <code>m22</code> elements specify horizontal and vertical scaling. The <code>m21</code> and <code>m12</code> elements specify horizontal and vertical <i>shearing</i>. And finally, the <code>m13</code> and <code>m23</code> elements specify horizontal and vertical projection, with <code>m33</code> as an additional projection factor.</p>
<p>QTransform transforms a point in the plane to another point using the following formulas:</p>
<pre class="cpp">

  x<span class="char">' = m11*x + m21*y + dx
  y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> dy
  <span class="keyword">if</span> (is <span class="keyword">not</span> affine) {
      w<span class="char">' = m13*x + m23*y + m33
      x'</span> <span class="operator">/</span><span class="operator">=</span> w<span class="char">'
      y'</span> <span class="operator">/</span><span class="operator">=</span> w<span class="char">'
  }

</pre>
<p>The point <i>(x, y)</i> is the original point, and <i>(x', y')</i> is the transformed point. <i>(x', y')</i> can be transformed back to <i>(x, y)</i> by performing the same operation on the <a href="qtransform.html#inverted">inverted</a>() matrix.</p>
<p>The various matrix elements can be set when constructing the matrix, or by using the <a href="qtransform.html#setMatrix">setMatrix</a>() function later on. They can also be manipulated using the <a href="qtransform.html#translate">translate</a>(), <a href="qtransform.html#rotate">rotate</a>(), <a href="qtransform.html#scale">scale</a>() and <a href="qtransform.html#shear">shear</a>() convenience functions. The currently set values can be retrieved using the <a href="qtransform.html#m11">m11</a>(), <a href="qtransform.html#m12">m12</a>(), <a href="qtransform.html#m13">m13</a>(), <a href="qtransform.html#m21">m21</a>(), <a href="qtransform.html#m22">m22</a>(), <a href="qtransform.html#m23">m23</a>(), <a href="qtransform.html#m31">m31</a>(), <a href="qtransform.html#m32">m32</a>(), <a href="qtransform.html#m33">m33</a>(), <a href="qtransform.html#dx">dx</a>() and <a href="qtransform.html#dy">dy</a>() functions.</p>
<p>Translation is the simplest transformation. Setting <code>dx</code> and <code>dy</code> will move the coordinate system <code>dx</code> units along the X axis and <code>dy</code> units along the Y axis. Scaling can be done by setting <code>m11</code> and <code>m22</code>. For example, setting <code>m11</code> to 2 and <code>m22</code> to 1.5 will double the height and increase the width by 50%. The identity matrix has <code>m11</code>, <code>m22</code>, and <code>m33</code> set to 1 (all others are set to 0) mapping a point to itself. Shearing is controlled by <code>m12</code> and <code>m21</code>. Setting these elements to values different from zero will twist the coordinate system. Rotation is achieved by setting both the shearing factors and the scaling factors. Perspective transformation is achieved by setting both the projection factors and the scaling factors.</p>
<p>Here's the combined transformations example using basic matrix operations:</p>
<div class="table"><table class="generic" width="100%">
 <tr valign="top" class="odd"><td ><img src="images/qtransform-combinedtransformation2.png" alt="" /></td><td ><pre class="cpp">

  <span class="type">void</span> BasicOperations<span class="operator">::</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
  {
      <span class="type">double</span> pi <span class="operator">=</span> <span class="number">3.14</span>;

      <span class="type">double</span> a    <span class="operator">=</span> pi<span class="operator">/</span><span class="number">180</span> <span class="operator">*</span> <span class="number">45.0</span>;
      <span class="type">double</span> sina <span class="operator">=</span> sin(a);
      <span class="type">double</span> cosa <span class="operator">=</span> cos(a);

      <span class="type">QTransform</span> translationTransform(<span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">50.0</span><span class="operator">,</span> <span class="number">50.0</span>);
      <span class="type">QTransform</span> rotationTransform(cosa<span class="operator">,</span> sina<span class="operator">,</span> <span class="operator">-</span>sina<span class="operator">,</span> cosa<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
      <span class="type">QTransform</span> scalingTransform(<span class="number">0.5</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1.0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);

      <span class="type">QTransform</span> transform;
      transform <span class="operator">=</span> scalingTransform <span class="operator">*</span> rotationTransform <span class="operator">*</span> translationTransform;

      <span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
      painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type">Qt</span><span class="operator">::</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type">Qt</span><span class="operator">::</span>DashLine));
      painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);

      painter<span class="operator">.</span>setTransform(transform);

      painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">&quot;Helvetica&quot;</span><span class="operator">,</span> <span class="number">24</span>));
      painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type">Qt</span><span class="operator">::</span>black<span class="operator">,</span> <span class="number">1</span>));
      painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">&quot;QTransform&quot;</span>);
  }

</pre>
</td></tr>
</table></div>
</div>
<p><b>See also </b><a href="qpainter.html">QPainter</a>, <a href="coordsys.html">Coordinate System</a>, <a href="../qtwidgets/qtwidgets-painting-affine-example.html">Affine Transformations Example</a>, and <a href="../qtwidgets/qtwidgets-painting-transformations-example.html">Transformations Example</a>.</p>
<!-- @@@QTransform -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$TransformationType$$$TxNone$$$TxTranslate$$$TxScale$$$TxRotate$$$TxShear$$$TxProject -->
<h3 class="fn" id="TransformationType-enum"><a name="TransformationType-enum"></a>enum QTransform::<span class="name">TransformationType</span></h3>
<div class="table"><table class="valuelist"><tr><th class="tblConst">Constant</th><th class="tblVal">Value</th></tr>
<tr><td class="topAlign"><code>QTransform::TxNone</code></td><td class="topAlign tblval"><code>0x00</code></td></tr>
<tr><td class="topAlign"><code>QTransform::TxTranslate</code></td><td class="topAlign tblval"><code>0x01</code></td></tr>
<tr><td class="topAlign"><code>QTransform::TxScale</code></td><td class="topAlign tblval"><code>0x02</code></td></tr>
<tr><td class="topAlign"><code>QTransform::TxRotate</code></td><td class="topAlign tblval"><code>0x04</code></td></tr>
<tr><td class="topAlign"><code>QTransform::TxShear</code></td><td class="topAlign tblval"><code>0x08</code></td></tr>
<tr><td class="topAlign"><code>QTransform::TxProject</code></td><td class="topAlign tblval"><code>0x10</code></td></tr>
</table></div>
<!-- @@@TransformationType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QTransform$$$QTransformconstQMatrix& -->
<h3 class="fn" id="QTransform-4"><a name="QTransform-4"></a>QTransform::<span class="name">QTransform</span>(const <span class="type"><a href="qmatrix.html">QMatrix</a></span> &amp;<i>matrix</i>)</h3>
<p>Constructs a matrix that is a copy of the given <i>matrix</i>. Note that the <code>m13</code>, <code>m23</code>, and <code>m33</code> elements are set to 0, 0, and 1 respectively.</p>
<!-- @@@QTransform -->
<!-- $$$QTransform$$$QTransformqrealqrealqrealqrealqrealqreal -->
<h3 class="fn" id="QTransform-3"><a name="QTransform-3"></a>QTransform::<span class="name">QTransform</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m11</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m12</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m21</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m22</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dy</i>)</h3>
<p>Constructs a matrix with the elements, <i>m11</i>, <i>m12</i>, <i>m21</i>, <i>m22</i>, <i>dx</i> and <i>dy</i>.</p>
<p><b>See also </b><a href="qtransform.html#setMatrix">setMatrix</a>().</p>
<!-- @@@QTransform -->
<!-- $$$QTransform$$$QTransformqrealqrealqrealqrealqrealqrealqrealqrealqreal -->
<h3 class="fn" id="QTransform-2"><a name="QTransform-2"></a>QTransform::<span class="name">QTransform</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m11</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m12</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m13</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m21</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m22</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m23</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m31</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m32</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m33</i> = 1.0)</h3>
<p>Constructs a matrix with the elements, <i>m11</i>, <i>m12</i>, <i>m13</i>, <i>m21</i>, <i>m22</i>, <i>m23</i>, <i>m31</i>, <i>m32</i>, <i>m33</i>.</p>
<p><b>See also </b><a href="qtransform.html#setMatrix">setMatrix</a>().</p>
<!-- @@@QTransform -->
<!-- $$$QTransform$$$QTransform -->
<h3 class="fn" id="QTransform-1"><a name="QTransform-1"></a>QTransform::<span class="name">QTransform</span>()</h3>
<p>Constructs an identity matrix.</p>
<p>All elements are set to zero except <code>m11</code> and <code>m22</code> (specifying the scale) and <code>m33</code> which are set to 1.</p>
<p><b>See also </b><a href="qtransform.html#reset">reset</a>().</p>
<!-- @@@QTransform -->
<!-- $$$operator=$$$operator=constQTransform& -->
<h3 class="fn" id="operator-eq-1"><a name="operator-eq-1"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">operator=</span>(const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>Assigns the given <i>matrix</i>'s values to this matrix.</p>
<!-- @@@operator= -->
<!-- $$$m11[overload1]$$$m11 -->
<h3 class="fn" id="m11"><a name="m11"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m11</span>() const</h3>
<p>Returns the horizontal scaling factor.</p>
<p><b>See also </b><a href="qtransform.html#scale">scale</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m11 -->
<!-- $$$m12[overload1]$$$m12 -->
<h3 class="fn" id="m12"><a name="m12"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m12</span>() const</h3>
<p>Returns the vertical shearing factor.</p>
<p><b>See also </b><a href="qtransform.html#shear">shear</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m12 -->
<!-- $$$m13[overload1]$$$m13 -->
<h3 class="fn" id="m13"><a name="m13"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m13</span>() const</h3>
<p>Returns the horizontal projection factor.</p>
<p><b>See also </b><a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m13 -->
<!-- $$$m21[overload1]$$$m21 -->
<h3 class="fn" id="m21"><a name="m21"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m21</span>() const</h3>
<p>Returns the horizontal shearing factor.</p>
<p><b>See also </b><a href="qtransform.html#shear">shear</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m21 -->
<!-- $$$m22[overload1]$$$m22 -->
<h3 class="fn" id="m22"><a name="m22"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m22</span>() const</h3>
<p>Returns the vertical scaling factor.</p>
<p><b>See also </b><a href="qtransform.html#scale">scale</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m22 -->
<!-- $$$m23[overload1]$$$m23 -->
<h3 class="fn" id="m23"><a name="m23"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m23</span>() const</h3>
<p>Returns the vertical projection factor.</p>
<p><b>See also </b><a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m23 -->
<!-- $$$m31[overload1]$$$m31 -->
<h3 class="fn" id="m31"><a name="m31"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m31</span>() const</h3>
<p>Returns the horizontal translation factor.</p>
<p><b>See also </b><a href="qtransform.html#dx">dx</a>(), <a href="qtransform.html#translate">translate</a>(), and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m31 -->
<!-- $$$m32[overload1]$$$m32 -->
<h3 class="fn" id="m32"><a name="m32"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m32</span>() const</h3>
<p>Returns the vertical translation factor.</p>
<p><b>See also </b><a href="qtransform.html#dy">dy</a>(), <a href="qtransform.html#translate">translate</a>(), and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m32 -->
<!-- $$$m33[overload1]$$$m33 -->
<h3 class="fn" id="m33"><a name="m33"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">m33</span>() const</h3>
<p>Returns the division factor.</p>
<p><b>See also </b><a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@m33 -->
<!-- $$$adjoint[overload1]$$$adjoint -->
<h3 class="fn" id="adjoint"><a name="adjoint"></a><span class="type">QTransform</span> QTransform::<span class="name">adjoint</span>() const</h3>
<p>Returns the adjoint of this matrix.</p>
<!-- @@@adjoint -->
<!-- $$$determinant[overload1]$$$determinant -->
<h3 class="fn" id="determinant"><a name="determinant"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">determinant</span>() const</h3>
<p>Returns the matrix's determinant.</p>
<!-- @@@determinant -->
<!-- $$$dx[overload1]$$$dx -->
<h3 class="fn" id="dx"><a name="dx"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">dx</span>() const</h3>
<p>Returns the horizontal translation factor.</p>
<p><b>See also </b><a href="qtransform.html#m31">m31</a>(), <a href="qtransform.html#translate">translate</a>(), and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@dx -->
<!-- $$$dy[overload1]$$$dy -->
<h3 class="fn" id="dy"><a name="dy"></a><span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> QTransform::<span class="name">dy</span>() const</h3>
<p>Returns the vertical translation factor.</p>
<p><b>See also </b><a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@dy -->
<!-- $$$fromScale[overload1]$$$fromScaleqrealqreal -->
<h3 class="fn" id="fromScale"><a name="fromScale"></a><code>[static] </code><span class="type">QTransform</span> QTransform::<span class="name">fromScale</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sy</i>)</h3>
<p>Creates a matrix which corresponds to a scaling of <i>sx</i> horizontally and <i>sy</i> vertically. This is the same as <a href="qtransform.html#QTransform-1">QTransform</a>().scale(sx, sy) but slightly faster.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fromScale -->
<!-- $$$fromTranslate[overload1]$$$fromTranslateqrealqreal -->
<h3 class="fn" id="fromTranslate"><a name="fromTranslate"></a><code>[static] </code><span class="type">QTransform</span> QTransform::<span class="name">fromTranslate</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dy</i>)</h3>
<p>Creates a matrix which corresponds to a translation of <i>dx</i> along the x axis and <i>dy</i> along the y axis. This is the same as <a href="qtransform.html#QTransform-1">QTransform</a>().translate(dx, dy) but slightly faster.</p>
<p>This function was introduced in Qt 4.5.</p>
<!-- @@@fromTranslate -->
<!-- $$$inverted[overload1]$$$invertedbool* -->
<h3 class="fn" id="inverted"><a name="inverted"></a><span class="type">QTransform</span> QTransform::<span class="name">inverted</span>(<span class="type">bool</span> *<i>invertible</i> = nullptr) const</h3>
<p>Returns an inverted copy of this matrix.</p>
<p>If the matrix is singular (not invertible), the returned matrix is the identity matrix. If <i>invertible</i> is valid (i.e&#x2e; not 0), its value is set to true if the matrix is invertible, otherwise it is set to false.</p>
<p><b>See also </b><a href="qtransform.html#isInvertible">isInvertible</a>().</p>
<!-- @@@inverted -->
<!-- $$$isAffine[overload1]$$$isAffine -->
<h3 class="fn" id="isAffine"><a name="isAffine"></a><span class="type">bool</span> QTransform::<span class="name">isAffine</span>() const</h3>
<p>Returns <code>true</code> if the matrix represent an affine transformation, otherwise returns <code>false</code>.</p>
<!-- @@@isAffine -->
<!-- $$$isIdentity[overload1]$$$isIdentity -->
<h3 class="fn" id="isIdentity"><a name="isIdentity"></a><span class="type">bool</span> QTransform::<span class="name">isIdentity</span>() const</h3>
<p>Returns <code>true</code> if the matrix is the identity matrix, otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtransform.html#reset">reset</a>().</p>
<!-- @@@isIdentity -->
<!-- $$$isInvertible[overload1]$$$isInvertible -->
<h3 class="fn" id="isInvertible"><a name="isInvertible"></a><span class="type">bool</span> QTransform::<span class="name">isInvertible</span>() const</h3>
<p>Returns <code>true</code> if the matrix is invertible, otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtransform.html#inverted">inverted</a>().</p>
<!-- @@@isInvertible -->
<!-- $$$isRotating[overload1]$$$isRotating -->
<h3 class="fn" id="isRotating"><a name="isRotating"></a><span class="type">bool</span> QTransform::<span class="name">isRotating</span>() const</h3>
<p>Returns <code>true</code> if the matrix represents some kind of a rotating transformation, otherwise returns <code>false</code>.</p>
<p><b>Note: </b>A rotation transformation of 180 degrees and/or 360 degrees is treated as a scaling transformation.</p><p><b>See also </b><a href="qtransform.html#reset">reset</a>().</p>
<!-- @@@isRotating -->
<!-- $$$isScaling[overload1]$$$isScaling -->
<h3 class="fn" id="isScaling"><a name="isScaling"></a><span class="type">bool</span> QTransform::<span class="name">isScaling</span>() const</h3>
<p>Returns <code>true</code> if the matrix represents a scaling transformation, otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtransform.html#reset">reset</a>().</p>
<!-- @@@isScaling -->
<!-- $$$isTranslating[overload1]$$$isTranslating -->
<h3 class="fn" id="isTranslating"><a name="isTranslating"></a><span class="type">bool</span> QTransform::<span class="name">isTranslating</span>() const</h3>
<p>Returns <code>true</code> if the matrix represents a translating transformation, otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qtransform.html#reset">reset</a>().</p>
<!-- @@@isTranslating -->
<!-- $$$map[overload1]$$$mapqrealqrealqreal*qreal* -->
<h3 class="fn" id="map"><a name="map"></a><span class="type">void</span> QTransform::<span class="name">map</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> *<i>tx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> *<i>ty</i>) const</h3>
<p>Maps the given coordinates <i>x</i> and <i>y</i> into the coordinate system defined by this matrix. The resulting values are put in *<i>tx</i> and *<i>ty</i>, respectively.</p>
<p>The coordinates are transformed using the following formulas:</p>
<pre class="cpp">

  x'</span> <span class="operator">=</span> m11<span class="operator">*</span>x <span class="operator">+</span> m21<span class="operator">*</span>y <span class="operator">+</span> dx
  y<span class="char">' = m22*y + m12*x + dy
  if (is not affine) {
      w'</span> <span class="operator">=</span> m13<span class="operator">*</span>x <span class="operator">+</span> m23<span class="operator">*</span>y <span class="operator">+</span> m33
      x<span class="char">' /= w'</span>
      y<span class="char">' /= w'</span>
  }

</pre>
<p>The point (x, y) is the original point, and (x', y') is the transformed point.</p>
<p><b>See also </b><a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPoint& -->
<h3 class="fn" id="map-1"><a name="map-1"></a><span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> QTransform::<span class="name">map</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="../qtcore/qpoint.html">QPoint</a> object that is a copy of the given <i>point</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPointF& -->
<h3 class="fn" id="map-2"><a name="map-2"></a><span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> QTransform::<span class="name">map</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>p</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="../qtcore/qpointf.html">QPointF</a> object that is a copy of the given point, <i>p</i>, mapped into the coordinate system defined by this matrix.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQLine& -->
<h3 class="fn" id="map-3"><a name="map-3"></a><span class="type"><a href="../qtcore/qline.html">QLine</a></span> QTransform::<span class="name">map</span>(const <span class="type"><a href="../qtcore/qline.html">QLine</a></span> &amp;<i>l</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="../qtcore/qlinef.html">QLineF</a> object that is a copy of the given line, <i>l</i>, mapped into the coordinate system defined by this matrix.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQLineF& -->
<h3 class="fn" id="map-4"><a name="map-4"></a><span class="type"><a href="../qtcore/qlinef.html">QLineF</a></span> QTransform::<span class="name">map</span>(const <span class="type"><a href="../qtcore/qlinef.html">QLineF</a></span> &amp;<i>line</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="../qtcore/qline.html">QLine</a> object that is a copy of the given <i>line</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPolygonF& -->
<h3 class="fn" id="map-5"><a name="map-5"></a><span class="type"><a href="qpolygonf.html">QPolygonF</a></span> QTransform::<span class="name">map</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>polygon</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpolygonf.html">QPolygonF</a> object that is a copy of the given <i>polygon</i>, mapped into the coordinate system defined by this matrix.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPolygon& -->
<h3 class="fn" id="map-6"><a name="map-6"></a><span class="type"><a href="qpolygon.html">QPolygon</a></span> QTransform::<span class="name">map</span>(const <span class="type"><a href="qpolygon.html">QPolygon</a></span> &amp;<i>polygon</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpolygon.html">QPolygon</a> object that is a copy of the given <i>polygon</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQRegion& -->
<h3 class="fn" id="map-7"><a name="map-7"></a><span class="type"><a href="qregion.html">QRegion</a></span> QTransform::<span class="name">map</span>(const <span class="type"><a href="qregion.html">QRegion</a></span> &amp;<i>region</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qregion.html">QRegion</a> object that is a copy of the given <i>region</i>, mapped into the coordinate system defined by this matrix.</p>
<p>Calling this method can be rather expensive if rotations or shearing are used.</p>
<!-- @@@map -->
<!-- $$$map$$$mapconstQPainterPath& -->
<h3 class="fn" id="map-8"><a name="map-8"></a><span class="type"><a href="qpainterpath.html">QPainterPath</a></span> QTransform::<span class="name">map</span>(const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpainterpath.html">QPainterPath</a> object that is a copy of the given <i>path</i>, mapped into the coordinate system defined by this matrix.</p>
<!-- @@@map -->
<!-- $$$map$$$mapintintint*int* -->
<h3 class="fn" id="map-9"><a name="map-9"></a><span class="type">void</span> QTransform::<span class="name">map</span>(<span class="type">int</span> <i>x</i>, <span class="type">int</span> <i>y</i>, <span class="type">int</span> *<i>tx</i>, <span class="type">int</span> *<i>ty</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Maps the given coordinates <i>x</i> and <i>y</i> into the coordinate system defined by this matrix. The resulting values are put in *<i>tx</i> and *<i>ty</i>, respectively. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@map -->
<!-- $$$mapRect[overload1]$$$mapRectconstQRectF& -->
<h3 class="fn" id="mapRect"><a name="mapRect"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QTransform::<span class="name">mapRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>) const</h3>
<p>Creates and returns a <a href="../qtcore/qrectf.html">QRectF</a> object that is a copy of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix.</p>
<p>The rectangle's coordinates are transformed using the following formulas:</p>
<pre class="cpp">

  x<span class="char">' = m11*x + m21*y + dx
  y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> dy
  <span class="keyword">if</span> (is <span class="keyword">not</span> affine) {
      w<span class="char">' = m13*x + m23*y + m33
      x'</span> <span class="operator">/</span><span class="operator">=</span> w<span class="char">'
      y'</span> <span class="operator">/</span><span class="operator">=</span> w<span class="char">'
  }

</pre>
<p>If rotation or shearing has been specified, this function returns the <i>bounding</i> rectangle. To retrieve the exact region the given <i>rectangle</i> maps to, use the <a href="qtransform.html#mapToPolygon">mapToPolygon</a>() function instead.</p>
<p><b>See also </b><a href="qtransform.html#mapToPolygon">mapToPolygon</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@mapRect -->
<!-- $$$mapRect$$$mapRectconstQRect& -->
<h3 class="fn" id="mapRect-1"><a name="mapRect-1"></a><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QTransform::<span class="name">mapRect</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Creates and returns a <a href="../qtcore/qrect.html">QRect</a> object that is a copy of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<!-- @@@mapRect -->
<!-- $$$mapToPolygon[overload1]$$$mapToPolygonconstQRect& -->
<h3 class="fn" id="mapToPolygon"><a name="mapToPolygon"></a><span class="type"><a href="qpolygon.html">QPolygon</a></span> QTransform::<span class="name">mapToPolygon</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &amp;<i>rectangle</i>) const</h3>
<p>Creates and returns a <a href="qpolygon.html">QPolygon</a> representation of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix.</p>
<p>The rectangle's coordinates are transformed using the following formulas:</p>
<pre class="cpp">

  x'</span> <span class="operator">=</span> m11<span class="operator">*</span>x <span class="operator">+</span> m21<span class="operator">*</span>y <span class="operator">+</span> dx
  y<span class="char">' = m22*y + m12*x + dy
  if (is not affine) {
      w'</span> <span class="operator">=</span> m13<span class="operator">*</span>x <span class="operator">+</span> m23<span class="operator">*</span>y <span class="operator">+</span> m33
      x<span class="char">' /= w'</span>
      y<span class="char">' /= w'</span>
  }

</pre>
<p>Polygons and rectangles behave slightly differently when transformed (due to integer rounding), so <code>matrix.map(QPolygon(rectangle))</code> is not always the same as <code>matrix.mapToPolygon(rectangle)</code>.</p>
<p><b>See also </b><a href="qtransform.html#mapRect">mapRect</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@mapToPolygon -->
<!-- $$$quadToQuad[overload1]$$$quadToQuadconstQPolygonF&constQPolygonF&QTransform& -->
<h3 class="fn" id="quadToQuad"><a name="quadToQuad"></a><code>[static] </code><span class="type">bool</span> QTransform::<span class="name">quadToQuad</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>one</i>, const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>two</i>, <span class="type">QTransform</span> &amp;<i>trans</i>)</h3>
<p>Creates a transformation matrix, <i>trans</i>, that maps a four-sided polygon, <i>one</i>, to another four-sided polygon, <i>two</i>. Returns <code>true</code> if the transformation is possible; otherwise returns false.</p>
<p>This is a convenience method combining <a href="qtransform.html#quadToSquare">quadToSquare</a>() and <a href="qtransform.html#squareToQuad">squareToQuad</a>() methods. It allows the input quad to be transformed into any other quad.</p>
<p><b>See also </b><a href="qtransform.html#squareToQuad">squareToQuad</a>() and <a href="qtransform.html#quadToSquare">quadToSquare</a>().</p>
<!-- @@@quadToQuad -->
<!-- $$$quadToSquare[overload1]$$$quadToSquareconstQPolygonF&QTransform& -->
<h3 class="fn" id="quadToSquare"><a name="quadToSquare"></a><code>[static] </code><span class="type">bool</span> QTransform::<span class="name">quadToSquare</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>quad</i>, <span class="type">QTransform</span> &amp;<i>trans</i>)</h3>
<p>Creates a transformation matrix, <i>trans</i>, that maps a four-sided polygon, <i>quad</i>, to a unit square. Returns <code>true</code> if the transformation is constructed or false if such a transformation does not exist.</p>
<p><b>See also </b><a href="qtransform.html#squareToQuad">squareToQuad</a>() and <a href="qtransform.html#quadToQuad">quadToQuad</a>().</p>
<!-- @@@quadToSquare -->
<!-- $$$reset[overload1]$$$reset -->
<h3 class="fn" id="reset"><a name="reset"></a><span class="type">void</span> QTransform::<span class="name">reset</span>()</h3>
<p>Resets the matrix to an identity matrix, i.e&#x2e; all elements are set to zero, except <code>m11</code> and <code>m22</code> (specifying the scale) and <code>m33</code> which are set to 1.</p>
<p><b>See also </b><a href="qtransform.html#QTransform-1">QTransform</a>(), <a href="qtransform.html#isIdentity">isIdentity</a>(), and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<!-- @@@reset -->
<!-- $$$rotate[overload1]$$$rotateqrealQt::Axis -->
<h3 class="fn" id="rotate"><a name="rotate"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">rotate</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>angle</i>, <span class="type"><a href="../qtcore/qt.html#Axis-enum">Qt::Axis</a></span> <i>axis</i> = Qt::ZAxis)</h3>
<p>Rotates the coordinate system counterclockwise by the given <i>angle</i> about the specified <i>axis</i> and returns a reference to the matrix.</p>
<p>Note that if you apply a <a href="qtransform.html">QTransform</a> to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.</p>
<p>The angle is specified in degrees.</p>
<p><b>See also </b><a href="qtransform.html#setMatrix">setMatrix</a>().</p>
<!-- @@@rotate -->
<!-- $$$rotateRadians[overload1]$$$rotateRadiansqrealQt::Axis -->
<h3 class="fn" id="rotateRadians"><a name="rotateRadians"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">rotateRadians</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>angle</i>, <span class="type"><a href="../qtcore/qt.html#Axis-enum">Qt::Axis</a></span> <i>axis</i> = Qt::ZAxis)</h3>
<p>Rotates the coordinate system counterclockwise by the given <i>angle</i> about the specified <i>axis</i> and returns a reference to the matrix.</p>
<p>Note that if you apply a <a href="qtransform.html">QTransform</a> to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.</p>
<p>The angle is specified in radians.</p>
<p><b>See also </b><a href="qtransform.html#setMatrix">setMatrix</a>().</p>
<!-- @@@rotateRadians -->
<!-- $$$scale[overload1]$$$scaleqrealqreal -->
<h3 class="fn" id="scale"><a name="scale"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">scale</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sy</i>)</h3>
<p>Scales the coordinate system by <i>sx</i> horizontally and <i>sy</i> vertically, and returns a reference to the matrix.</p>
<p><b>See also </b><a href="qtransform.html#setMatrix">setMatrix</a>().</p>
<!-- @@@scale -->
<!-- $$$setMatrix[overload1]$$$setMatrixqrealqrealqrealqrealqrealqrealqrealqrealqreal -->
<h3 class="fn" id="setMatrix"><a name="setMatrix"></a><span class="type">void</span> QTransform::<span class="name">setMatrix</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m11</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m12</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m13</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m21</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m22</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m23</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m31</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m32</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>m33</i>)</h3>
<p>Sets the matrix elements to the specified values, <i>m11</i>, <i>m12</i>, <i>m13</i> <i>m21</i>, <i>m22</i>, <i>m23</i> <i>m31</i>, <i>m32</i> and <i>m33</i>. Note that this function replaces the previous values. <a href="qtransform.html">QTransform</a> provides the <a href="qtransform.html#translate">translate</a>(), <a href="qtransform.html#rotate">rotate</a>(), <a href="qtransform.html#scale">scale</a>() and <a href="qtransform.html#shear">shear</a>() convenience functions to manipulate the various matrix elements based on the currently defined coordinate system.</p>
<p><b>See also </b><a href="qtransform.html#QTransform-1">QTransform</a>().</p>
<!-- @@@setMatrix -->
<!-- $$$shear[overload1]$$$shearqrealqreal -->
<h3 class="fn" id="shear"><a name="shear"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">shear</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sh</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>sv</i>)</h3>
<p>Shears the coordinate system by <i>sh</i> horizontally and <i>sv</i> vertically, and returns a reference to the matrix.</p>
<p><b>See also </b><a href="qtransform.html#setMatrix">setMatrix</a>().</p>
<!-- @@@shear -->
<!-- $$$squareToQuad[overload1]$$$squareToQuadconstQPolygonF&QTransform& -->
<h3 class="fn" id="squareToQuad"><a name="squareToQuad"></a><code>[static] </code><span class="type">bool</span> QTransform::<span class="name">squareToQuad</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>quad</i>, <span class="type">QTransform</span> &amp;<i>trans</i>)</h3>
<p>Creates a transformation matrix, <i>trans</i>, that maps a unit square to a four-sided polygon, <i>quad</i>. Returns <code>true</code> if the transformation is constructed or false if such a transformation does not exist.</p>
<p><b>See also </b><a href="qtransform.html#quadToSquare">quadToSquare</a>() and <a href="qtransform.html#quadToQuad">quadToQuad</a>().</p>
<!-- @@@squareToQuad -->
<!-- $$$toAffine[overload1]$$$toAffine -->
<h3 class="fn" id="toAffine"><a name="toAffine"></a>const <span class="type"><a href="qmatrix.html">QMatrix</a></span> &amp;QTransform::<span class="name">toAffine</span>() const</h3>
<p>Returns the <a href="qtransform.html">QTransform</a> as an affine matrix.</p>
<p><b>Warning:</b> If a perspective transformation has been specified, then the conversion will cause loss of data.</p>
<!-- @@@toAffine -->
<!-- $$$translate[overload1]$$$translateqrealqreal -->
<h3 class="fn" id="translate"><a name="translate"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">translate</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dx</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>dy</i>)</h3>
<p>Moves the coordinate system <i>dx</i> along the x axis and <i>dy</i> along the y axis, and returns a reference to the matrix.</p>
<p><b>See also </b><a href="qtransform.html#setMatrix">setMatrix</a>().</p>
<!-- @@@translate -->
<!-- $$$transposed[overload1]$$$transposed -->
<h3 class="fn" id="transposed"><a name="transposed"></a><span class="type">QTransform</span> QTransform::<span class="name">transposed</span>() const</h3>
<p>Returns the transpose of this matrix.</p>
<!-- @@@transposed -->
<!-- $$$type[overload1]$$$type -->
<h3 class="fn" id="type"><a name="type"></a><span class="type"><a href="qtransform.html#TransformationType-enum">QTransform::TransformationType</a></span> QTransform::<span class="name">type</span>() const</h3>
<p>Returns the transformation type of this matrix.</p>
<p>The transformation type is the highest enumeration value capturing all of the matrix's transformations. For example, if the matrix both scales and shears, the type would be <code>TxShear</code>, because <code>TxShear</code> has a higher enumeration value than <code>TxScale</code>.</p>
<p>Knowing the transformation type of a matrix is useful for optimization: you can often handle specific types more optimally than handling the generic case.</p>
<!-- @@@type -->
<!-- $$$operator QVariant[overload1]$$$operator QVariant -->
<h3 class="fn" id="operator-QVariant"><a name="operator-QVariant"></a><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QTransform::<span class="name">operator QVariant</span>() const</h3>
<p>Returns the transform as a <a href="../qtcore/qvariant.html">QVariant</a>.</p>
<!-- @@@operator QVariant -->
<!-- $$$operator!=[overload1]$$$operator!=constQTransform& -->
<h3 class="fn" id="operator-not-eq"><a name="operator-not-eq"></a><span class="type">bool</span> QTransform::<span class="name">operator!=</span>(const <span class="type">QTransform</span> &amp;<i>matrix</i>) const</h3>
<p>Returns <code>true</code> if this matrix is not equal to the given <i>matrix</i>, otherwise returns <code>false</code>.</p>
<!-- @@@operator!= -->
<!-- $$$operator*[overload1]$$$operator*constQTransform& -->
<h3 class="fn" id="operator-2a"><a name="operator-2a"></a><span class="type">QTransform</span> QTransform::<span class="name">operator*</span>(const <span class="type">QTransform</span> &amp;<i>matrix</i>) const</h3>
<p>Returns the result of multiplying this matrix by the given <i>matrix</i>.</p>
<p>Note that matrix multiplication is not commutative, i.e&#x2e; a*b != b*a.</p>
<!-- @@@operator* -->
<!-- $$$operator*=[overload1]$$$operator*=constQTransform& -->
<h3 class="fn" id="operator-2a-eq"><a name="operator-2a-eq"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">operator*=</span>(const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the result of multiplying this matrix by the given <i>matrix</i>.</p>
<!-- @@@operator*= -->
<!-- $$$operator*=$$$operator*=qreal -->
<h3 class="fn" id="operator-2a-eq-1"><a name="operator-2a-eq-1"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">operator*=</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>scalar</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the result of performing an element-wise multiplication of this matrix with the given <i>scalar</i>.</p>
<!-- @@@operator*= -->
<!-- $$$operator+=[overload1]$$$operator+=qreal -->
<h3 class="fn" id="operator-2b-eq"><a name="operator-2b-eq"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">operator+=</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>scalar</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the matrix obtained by adding the given <i>scalar</i> to each element of this matrix.</p>
<!-- @@@operator+= -->
<!-- $$$operator-=[overload1]$$$operator-=qreal -->
<h3 class="fn" id="operator--eq"><a name="operator--eq"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">operator-=</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>scalar</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the matrix obtained by subtracting the given <i>scalar</i> from each element of this matrix.</p>
<!-- @@@operator-= -->
<!-- $$$operator/=[overload1]$$$operator/=qreal -->
<h3 class="fn" id="operator-2f-eq"><a name="operator-2f-eq"></a><span class="type">QTransform</span> &amp;QTransform::<span class="name">operator/=</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>scalar</i>)</h3>
<p>This is an overloaded function.</p>
<p>Returns the result of performing an element-wise division of this matrix by the given <i>scalar</i>.</p>
<!-- @@@operator/= -->
<!-- $$$operator==[overload1]$$$operator==constQTransform& -->
<h3 class="fn" id="operator-eq-eq"><a name="operator-eq-eq"></a><span class="type">bool</span> QTransform::<span class="name">operator==</span>(const <span class="type">QTransform</span> &amp;<i>matrix</i>) const</h3>
<p>Returns <code>true</code> if this matrix is equal to the given <i>matrix</i>, otherwise returns <code>false</code>.</p>
<!-- @@@operator== -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$qFuzzyCompare[overload1]$$$qFuzzyCompareconstQTransform&constQTransform& -->
<h3 class="fn" id="qFuzzyCompare"><a name="qFuzzyCompare"></a><span class="type">bool</span> <span class="name">qFuzzyCompare</span>(const <span class="type">QTransform</span> &amp;<i>t1</i>, const <span class="type">QTransform</span> &amp;<i>t2</i>)</h3>
<p>Returns <code>true</code> if <i>t1</i> and <i>t2</i> are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.</p>
<p>This function was introduced in Qt 4.6.</p>
<!-- @@@qFuzzyCompare -->
<!-- $$$qHash$$$qHashconstQTransform&uint -->
<h3 class="fn" id="qHash-3"><a name="qHash-3"></a><span class="type"><a href="../qtcore/qtglobal.html#uint-typedef">uint</a></span> <span class="name">qHash</span>(const <span class="type">QTransform</span> &amp;<i>key</i>, <span class="type"><a href="../qtcore/qtglobal.html#uint-typedef">uint</a></span> <i>seed</i> = 0)</h3>
<p>Returns the hash value for <i>key</i>, using <i>seed</i> to seed the calculation.</p>
<p>This function was introduced in Qt 5.6.</p>
<!-- @@@qHash -->
<!-- $$$operator*$$$operator*constQPoint&constQTransform& -->
<h3 class="fn" id="operator-2a-11"><a name="operator-2a-11"></a><span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> <span class="name">operator*</span>(const <span class="type"><a href="../qtcore/qpoint.html">QPoint</a></span> &amp;<i>point</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>This is the same as <i>matrix</i>.map(<i>point</i>).</p>
<p><b>See also </b><a href="qtransform.html#map">QTransform::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPointF&constQTransform& -->
<h3 class="fn" id="operator-2a-12"><a name="operator-2a-12"></a><span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> <span class="name">operator*</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<i>point</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>Same as <i>matrix</i>.map(<i>point</i>).</p>
<p><b>See also </b><a href="qtransform.html#map">QTransform::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQLineF&constQTransform& -->
<h3 class="fn" id="operator-2a-13"><a name="operator-2a-13"></a><span class="type"><a href="../qtcore/qlinef.html">QLineF</a></span> <span class="name">operator*</span>(const <span class="type"><a href="../qtcore/qlinef.html">QLineF</a></span> &amp;<i>line</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>This is the same as <i>matrix</i>.map(<i>line</i>).</p>
<p><b>See also </b><a href="qtransform.html#map">QTransform::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQLine&constQTransform& -->
<h3 class="fn" id="operator-2a-14"><a name="operator-2a-14"></a><span class="type"><a href="../qtcore/qline.html">QLine</a></span> <span class="name">operator*</span>(const <span class="type"><a href="../qtcore/qline.html">QLine</a></span> &amp;<i>line</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>This is the same as <i>matrix</i>.map(<i>line</i>).</p>
<p><b>See also </b><a href="qtransform.html#map">QTransform::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPolygon&constQTransform& -->
<h3 class="fn" id="operator-2a-15"><a name="operator-2a-15"></a><span class="type"><a href="qpolygon.html">QPolygon</a></span> <span class="name">operator*</span>(const <span class="type"><a href="qpolygon.html">QPolygon</a></span> &amp;<i>polygon</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>This is the same as <i>matrix</i>.map(<i>polygon</i>).</p>
<p><b>See also </b><a href="qtransform.html#map">QTransform::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPolygonF&constQTransform& -->
<h3 class="fn" id="operator-2a-16"><a name="operator-2a-16"></a><span class="type"><a href="qpolygonf.html">QPolygonF</a></span> <span class="name">operator*</span>(const <span class="type"><a href="qpolygonf.html">QPolygonF</a></span> &amp;<i>polygon</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>This is the same as <i>matrix</i>.map(<i>polygon</i>).</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qtransform.html#map">QTransform::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQRegion&constQTransform& -->
<h3 class="fn" id="operator-2a-17"><a name="operator-2a-17"></a><span class="type"><a href="qregion.html">QRegion</a></span> <span class="name">operator*</span>(const <span class="type"><a href="qregion.html">QRegion</a></span> &amp;<i>region</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>This is the same as <i>matrix</i>.map(<i>region</i>).</p>
<p><b>See also </b><a href="qtransform.html#map">QTransform::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator*$$$operator*constQPainterPath&constQTransform& -->
<h3 class="fn" id="operator-2a-18"><a name="operator-2a-18"></a><span class="type"><a href="qpainterpath.html">QPainterPath</a></span> <span class="name">operator*</span>(const <span class="type"><a href="qpainterpath.html">QPainterPath</a></span> &amp;<i>path</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>This is the same as <i>matrix</i>.map(<i>path</i>).</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="qtransform.html#map">QTransform::map</a>().</p>
<!-- @@@operator* -->
<!-- $$$operator<<$$$operator<<QDataStream&constQTransform& -->
<h3 class="fn" id="operator-lt-lt-21"><a name="operator-lt-lt-21"></a><span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&lt;&lt;</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<i>stream</i>, const <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>Writes the given <i>matrix</i> to the given <i>stream</i> and returns a reference to the stream.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="../qtcore/datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator>>[overload1]$$$operator>>QDataStream&QTransform& -->
<h3 class="fn" id="operator-gt-gt"><a name="operator-gt-gt"></a><span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&gt;&gt;</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<i>stream</i>, <span class="type">QTransform</span> &amp;<i>matrix</i>)</h3>
<p>Reads the given <i>matrix</i> from the given <i>stream</i> and returns a reference to the stream.</p>
<p>This function was introduced in Qt 4.3.</p>
<p><b>See also </b><a href="../qtcore/datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator>> -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
